 
package com.zdkj.subway.support.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdkj.subway.support.entity.SwParamLine;
import com.zdkj.subway.support.mapper.SwParamLineMapper;
import com.zdkj.subway.support.service.SwParamLineService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 线路设置表
 *
 * @author cui_com
 * @date 2020-01-08 17:13:42
 */
@Service
@AllArgsConstructor
public class SwParamLineServiceImpl extends ServiceImpl<SwParamLineMapper, SwParamLine> implements SwParamLineService {

    private final SwParamLineMapper swParamLineMapper;
    @Override
    public List<SwParamLine> getAll() {
        return swParamLineMapper.getAll();
    }

    @Override
    public List<SwParamLine> getRealAll() {
        return swParamLineMapper.getRealAll();
    }

	@Override
    public List<SwParamLine> getLineByCondition(String lineCode){
		return swParamLineMapper.getLineByCondition(lineCode);
	}

    @Override
    public String getNameByCode(String code) {
        SwParamLine swParamLine = this.getOne(Wrappers.<SwParamLine>query().lambda().eq(SwParamLine::getCode,code));
        if(ObjectUtil.isNotEmpty(swParamLine)){
            return swParamLine.getName();
        }
        return "";
    }

	@Override
    public List<SwParamLine> getSecondNameLine(){
		return swParamLineMapper.getSecondNameLine();
	}

    @Override
    public List<SwParamLine> getLineByOperator(String operatorsId){
        return swParamLineMapper.getLines(operatorsId);
    }

    @Override
	public List<SwParamLine> getSecondNameLineByOperator(){
	
	    return swParamLineMapper.getSecondNameLineByOperator();
	}

    @Override
    public String getCodeByName(String name) {
        SwParamLine swParamLine = this.getOne(Wrappers.<SwParamLine>query().lambda().eq(SwParamLine::getName,name));
        if(ObjectUtil.isNotEmpty(swParamLine)){
            return swParamLine.getCode();
        }
        return "";
    }

    @Override
    public Map<String, String> getLnameAndSnameByCode(String lineCode, String code) {
        return swParamLineMapper.getLnameAndSnameByCode(lineCode,code);
    }

    @Override
    public List<SwParamLine> getSecondNameLineCase() {
        return swParamLineMapper.getSecondNameLineCase();
    }

    @Override
    public List<SwParamLine> getLineAll() {
        return swParamLineMapper.getLineAll();
    }

}
